Skip to content

Only fetch lib_features when there are unknown feature attributes#53444

Merged
bors merged 1 commit into
rust-lang:masterfrom
varkor:lib_features-conditional
Aug 21, 2018
Merged

Only fetch lib_features when there are unknown feature attributes#53444
bors merged 1 commit into
rust-lang:masterfrom
varkor:lib_features-conditional

Conversation

@varkor

@varkor varkor commented Aug 17, 2018

Copy link
Copy Markdown
Contributor

An attempt to win back some of the performance lost in #52644 (comment).

cc @nnethercote

@varkor

varkor commented Aug 17, 2018

Copy link
Copy Markdown
Contributor Author

@bors try

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @michaelwoerister

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 17, 2018
@bors

bors commented Aug 17, 2018

Copy link
Copy Markdown
Collaborator

⌛ Trying commit c4a0235 with merge b0dd0999595bf7fa0484adbda1627f36a88d60f6...

@rust-highfive

Copy link
Copy Markdown
Contributor

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
[00:44:00] ........ii.iii......................................................................................
[00:44:02] ....................................................................................................
[00:44:04] ....................................................................................................
[00:44:07] ....................................................................................................
[00:44:09] ..........................................F.........................................................
[00:44:15] ..........................................................i.........................................
[00:44:18] ....................................................................................................
[00:44:21] ....................................................................................................
[00:44:23] ...................................i................................................................
---
[00:45:33] ---- [ui] ui/feature-gate/stability-attribute-consistency.rs stdout ----
[00:45:33] 
[00:45:33] error: ui test compiled successfully!
[00:45:33] status: exit code: 0
[00:45:33] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/feature-gate/stability-attribute-consistency.rs" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/feature-gate/stability-attribute-consistency/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/feature-gate/stability-attribute-consistency/auxiliary" "-A" "unused"
[00:45:33] ------------------------------------------
[00:45:33] 
[00:45:33] ------------------------------------------
[00:45:33] stderr:

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bors

bors commented Aug 17, 2018

Copy link
Copy Markdown
Collaborator

☀️ Test successful - status-travis
State: approved= try=True

@michaelwoerister

Copy link
Copy Markdown
Member

@rust-timer build b0dd0999595bf7fa0484adbda1627f36a88d60f6

@rust-timer

Copy link
Copy Markdown
Collaborator

Success: Queued b0dd0999595bf7fa0484adbda1627f36a88d60f6 with parent d06fa3a, comparison URL.

@varkor

varkor commented Aug 17, 2018

Copy link
Copy Markdown
Contributor Author

I've pushed some more changes which will hopefully improve the situation further.

@bors try

@bors

bors commented Aug 17, 2018

Copy link
Copy Markdown
Collaborator

⌛ Trying commit dc30406 with merge 2e13a6c...

bors added a commit that referenced this pull request Aug 17, 2018
[WIP] Only fetch lib_features when there are unknown feature attributes

An attempt to win back some of the performance lost in #52644 (comment).

cc @nnethercote
@bors

bors commented Aug 17, 2018

Copy link
Copy Markdown
Collaborator

☀️ Test successful - status-travis
State: approved= try=True

@varkor

varkor commented Aug 17, 2018

Copy link
Copy Markdown
Contributor Author

@rust-timer build 2e13a6c

@rust-timer

Copy link
Copy Markdown
Collaborator

Success: Queued 2e13a6c with parent 8b923a1, comparison URL.

@varkor varkor changed the title [WIP] Only fetch lib_features when there are unknown feature attributes Only fetch lib_features when there are unknown feature attributes Aug 18, 2018
@varkor

varkor commented Aug 18, 2018

Copy link
Copy Markdown
Contributor Author

As far as I can tell @nnethercote, this completely negates the performance implications of #52644. Thanks for noticing! This is ready for review.

Comment thread src/librustc/middle/lib_features.rs Outdated

fn visit_item(&mut self, item: &'tcx Item) {
match item.node {
ItemKind::ExternCrate(_) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about Rust 2018, where extern crate is optional? Do inject these statements into HIR? That is, can we rely on them being present even if they come just from Cargo.toml?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point; I don't think this will work in the 2018 edition. Let me try tweaking things again.

// feature attributes if there are non-lang feature attributes, or a crate
// that depends on the current one has non-lang feature attributes. Thus,
// we're enabling an arbitrary lib feature to force the check to kick in.
#![feature(rustc_private)]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems a bit off that this is necessary? Isn't there a way of making sure these checks always run, if they are needed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should be able to refactor this so we always get the errors.

@varkor

varkor commented Aug 20, 2018

Copy link
Copy Markdown
Contributor Author

I'm trying a different approach: I'll rebase and comment again if it's successful. Back to WIP.

@varkor varkor changed the title Only fetch lib_features when there are unknown feature attributes [WIP] Only fetch lib_features when there are unknown feature attributes Aug 20, 2018
@rust-highfive

This comment has been minimized.

@varkor varkor force-pushed the lib_features-conditional branch from c0aa6c1 to 00ddfc8 Compare August 20, 2018 14:48
@varkor

varkor commented Aug 20, 2018

Copy link
Copy Markdown
Contributor Author

@bors try

@bors

bors commented Aug 20, 2018

Copy link
Copy Markdown
Collaborator

⌛ Trying commit 00ddfc8 with merge ff2e6f1...

bors added a commit that referenced this pull request Aug 20, 2018
[WIP] Only fetch lib_features when there are unknown feature attributes

An attempt to win back some of the performance lost in #52644 (comment).

cc @nnethercote
@bors

bors commented Aug 20, 2018

Copy link
Copy Markdown
Collaborator

☀️ Test successful - status-travis
State: approved= try=True

@varkor

varkor commented Aug 20, 2018

Copy link
Copy Markdown
Contributor Author

@rust-timer build ff2e6f1

@rust-timer

Copy link
Copy Markdown
Collaborator

Success: Queued ff2e6f1 with parent bf1e461, comparison URL.

@varkor varkor force-pushed the lib_features-conditional branch from 00ddfc8 to 1695856 Compare August 21, 2018 00:40
@varkor varkor changed the title [WIP] Only fetch lib_features when there are unknown feature attributes Only fetch lib_features when there are unknown feature attributes Aug 21, 2018
@varkor

varkor commented Aug 21, 2018

Copy link
Copy Markdown
Contributor Author

The perf improvements are slightly worse than the previous iteration, but that's to be expected, because we're iterating through every crate, which is necessary for the 2018 edition. It still minimises the biggest regressions, though and without affecting error messages.

@michaelwoerister: ready for another look! (I've rebased because the approach completely changed.)

@michaelwoerister

Copy link
Copy Markdown
Member

Performance looks at least as good as before, I think. Thanks for the update, @varkor!

@bors r+

@bors

bors commented Aug 21, 2018

Copy link
Copy Markdown
Collaborator

📌 Commit 1695856 has been approved by michaelwoerister

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 21, 2018
@bors

bors commented Aug 21, 2018

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 1695856 with merge 2d6d3ac...

bors added a commit that referenced this pull request Aug 21, 2018
…ister

Only fetch lib_features when there are unknown feature attributes

An attempt to win back some of the performance lost in #52644 (comment).

cc @nnethercote
@bors

bors commented Aug 21, 2018

Copy link
Copy Markdown
Collaborator

☀️ Test successful - status-appveyor, status-travis
Approved by: michaelwoerister
Pushing 2d6d3ac to master...

@bors bors merged commit 1695856 into rust-lang:master Aug 21, 2018
@varkor varkor deleted the lib_features-conditional branch August 21, 2018 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants